<?php
require_once '../common/RootPath.php';
RootPath::importPath("dao/BaseMapper.php");
RootPath::importPath("config/Database.php");

class TagMapper implements BaseMapper
{
    private $db;
    const tableName = "ms_tag"; //表名

    public function __construct()
    {
        $this->db = new Database();
    }


    public function findTagsByArticleId($articleId)
    {
        $sql ="                  		
        SELECT
            t.id tag_id,
            t.tag_name,
            t.avatar
        FROM
            ms_article a
            JOIN ms_article_tag at1 ON a.id = at1.article_id
            JOIN ms_tag t ON at1.tag_id = t.id
            WHERE a.id = $articleId
        ";
        return $sql;
        //$this->db->customSQL();
    }


    public function insert($record)
    {
        // TODO: Implement insert() method.
    }

    public function selectByPrimaryKey($id)
    {
        // TODO: Implement selectByPrimaryKey() method.
    }

    public function selectPage($pagination)
    {
        // TODO: Implement selectPage() method.
    }

    public function updateByPrimaryKey($id)
    {
        // TODO: Implement updateByPrimaryKey() method.
    }

    public function deleteByPrimaryKey($id)
    {
        // TODO: Implement deleteByPrimaryKey() method.
    }

    public function selectAllPage($pagination)
    {
        // TODO: Implement selectAllPage() method.
    }
}